package me.boot.sys.mapper;

import me.boot.db.mybatis.template.SuperMapper;
import me.boot.sys.entity.SysApp;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Sylar
 * @since 2021-11-24
 */
public interface SysAppMapper extends SuperMapper<SysApp> {

    /**
     * 通过clientId在数据库中查找对应Client
     *
     * @param clientId clientId
     * @return ClientDetail
     */
    @Select("select * from sys_app where client_id=#{clientId} and deleted = 0")
    SysApp getByClientId(@Param("clientId") String clientId);

    /**
     * 根据clientId移除对应client信息
     *
     * @param clientId clientId
     * @return 是否移除成功
     */
    @Update("update sys_app set deleted = 1 where client_id =#{clientId} and deleted = 0")
    boolean deleteByClientId(@Param("clientId") String clientId);

}
